﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace RichTextEditor
{
    public class RichTextBoxEditor: RichTextBox
    {
        public RichTextBoxEditor()
        {
            System.Windows.Forms.ContextMenuStrip context = new ContextMenuStrip();
            ToolStripButton editar = new ToolStripButton("Editar");
            context.Items.Add(editar);
            editar.Click += new EventHandler(editar_Click);
            this.ContextMenuStrip = context;
        }

        void editar_Click(object sender, EventArgs e)
        {
            FrmEditor editor = new FrmEditor();
            editor.RtfText = this.Rtf;
            editor.ShowDialog();
            if (MessageBox.Show("Deseja atualizar o texto do controle com o texto do editor?", "Atenção!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                this.Rtf = editor.RtfText;
        }
    }
}
